import time
from library.HTMLTestRunner import HTMLTestRunner
from utils.handle_path import *
import unittest
from utils.handle_email import HandleEmail

now = time.strftime('%Y-%m-%d %H_%M_%S')
filename = report_path + '/' + str(now) + 'result.html'


def fst():
    d = unittest.TestLoader().discover(start_dir=case_path, pattern='test*.py')
    f = open(filename, 'wb')
    r = HTMLTestRunner(stream=f, title='接口测试报告', description='测试用例执行情况')
    r.run(d)
    f.close()


# def syj():
#     sm=HandleEmail(smtp_server='smtp.163.com',smtp_port=25,sender_email='',sender_password='')
#     sm.send_email()

if __name__ == '__main__':
    fst()
    # syj()
